import 'package:flutter/material.dart';
class CustomErrorWidget extends StatelessWidget{
  final String message;
  final VoidCallback onRetry;

  const CustomErrorWidget({
    super.key,
    required this.message,
    required this.onRetry
});
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          const   Icon(Icons.error_outline,size: 64,color: Colors.red),
          const SizedBox(height: 16),
          Text('出错了',style: Theme.of(context).textTheme.headlineSmall,),
          const SizedBox(height: 8,),
          Padding(padding: const EdgeInsets.symmetric(horizontal: 32.0),
            child: Text(
              message,
              textAlign:TextAlign.center,
              style:Theme.of(context).textTheme.bodyMedium,
            ),
          ),
          const  SizedBox(height: 24,),
          ElevatedButton.icon(onPressed: onRetry, label:const Text('重试'),icon:const Icon(Icons.refresh))
        ],
      ),
    );
  }

}